package com.itheima.pojo;

import java.io.Serializable;
import java.util.*;

/**
 * 菜单
 */
public class Menu implements Serializable {
    private Integer id;
    private String name; // 菜单名称
    private String linkUrl; // 访问路径
    private String path;//菜单项所对应的路由路径
    private Integer priority; // 优先级（用于排序）
    private String description; // 描述
    private String icon;//图标
    private Set<Role> roles = new HashSet<Role>(0);//角色集合
    private List<Menu> children = new ArrayList<>();//子菜单集合
    private Integer parentMenuId;//父菜单id

    @Override
    public String toString() {
        return "Menu{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", linkUrl='" + linkUrl + '\'' +
                ", path='" + path + '\'' +
                ", priority=" + priority +
                ", description='" + description + '\'' +
                ", icon='" + icon + '\'' +
                ", roles=" + roles +
                ", children=" + children +
                ", parentMenuId=" + parentMenuId +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLinkUrl() {
        return linkUrl;
    }

    public void setLinkUrl(String linkUrl) {
        this.linkUrl = linkUrl;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public Integer getPriority() {
        return priority;
    }

    public void setPriority(Integer priority) {
        this.priority = priority;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Set<Role> getRoles() {
        return roles;
    }

    public void setRoles(Set<Role> roles) {
        this.roles = roles;
    }

    public List<Menu> getChildren() {
        return children;
    }

    public void setChildren(List<Menu> children) {
        this.children = children;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public Integer getParentMenuId() {
        return parentMenuId;
    }

    public void setParentMenuId(Integer parentMenuId) {
        this.parentMenuId = parentMenuId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return false;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        Menu menu = (Menu) o;

        if (id != null ? !id.equals(menu.id) : menu.id != null) {
            return false;
        }
        if (name != null ? !name.equals(menu.name) : menu.name != null) {
            return false;
        }
        if (linkUrl != null ? !linkUrl.equals(menu.linkUrl) : menu.linkUrl != null) {
            return false;
        }
        if (path != null ? !path.equals(menu.path) : menu.path != null) {
            return false;
        }
        if (priority != null ? !priority.equals(menu.priority) : menu.priority != null) {
            return false;
        }
        if (description != null ? !description.equals(menu.description) : menu.description != null) {
            return false;
        }
        if (icon != null ? !icon.equals(menu.icon) : menu.icon != null) {
            return false;
        }
        if (roles != null ? !roles.equals(menu.roles) : menu.roles != null) {
            return false;
        }
        if (children != null ? !children.equals(menu.children) : menu.children != null) {
            return false;
        }
        return parentMenuId != null ? parentMenuId.equals(menu.parentMenuId) : menu.parentMenuId == null;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (linkUrl != null ? linkUrl.hashCode() : 0);
        result = 31 * result + (path != null ? path.hashCode() : 0);
        result = 31 * result + (priority != null ? priority.hashCode() : 0);
        result = 31 * result + (description != null ? description.hashCode() : 0);
        result = 31 * result + (icon != null ? icon.hashCode() : 0);
        result = 31 * result + (roles != null ? roles.hashCode() : 0);
        result = 31 * result + (children != null ? children.hashCode() : 0);
        result = 31 * result + (parentMenuId != null ? parentMenuId.hashCode() : 0);
        return result;
    }
}
